<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改小区')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-community-edit" th:object="${fzSCommunity}">
            <input name="communityId" th:field="*{communityId}" type="hidden">

            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">小区名称：</label>
                <div class="col-sm-8">
                    <input name="name" th:field="*{name}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">小区地址：</label>
                <div class="col-sm-8">
                    <input name="address" th:field="*{address}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">地标：</label>
                <div class="col-sm-8">
                    <input name="nearbyLandmarks" th:field="*{nearbyLandmarks}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">城市编码：</label>
                <div class="col-sm-8">
                    <input name="cityCode" th:field="*{cityCode}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">x坐标：</label>
                <div class="col-sm-8">
                    <input name="mapX" id="mapX"  th:field="*{mapX}" readonly="readonly"  style="width:430px;display: inline" class="form-control" type="text" required>
                    <span style="margin-left: 30px" onclick="editFullWei()" class="fa fa-map-pin"></span>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">y坐标：</label>
                <div class="col-sm-8">
                    <input name="mapY" id="mapY" readonly="readonly" th:field="*{mapY}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">数据状态</label>
                <div class="col-sm-8">
                    <input name="statusCd" th:field="*{statusCd}" class="form-control" type="text" required>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "system/community";
        $("#form-community-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-community-edit').serialize());
            }
        }


        function editFullWei(){
            var yi1=($("#mapX").val()==null || $("#mapX").val()=="" )?"1":$("#mapX").val();
            var er1=($("#mapY").val()==null || $("#mapY").val()=="")?"1":$("#mapY").val();
            var index = layer.open({
                type: 2,
                area: [800+ 'px', ($(window).height() - 50) + 'px'],
                fix: false,
                //不固定
                maxmin: true,
                shade: 0.3,
                title: "修改小区坐标",
                content: prefix+"/editDian?along="+yi1+"&latitude="+er1,
                btn: ['确定', '关闭'],
                // 弹层外区域关闭
                shadeClose: true,
                yes: doSubmit,
                cancel: function(index) {
                    return true;
                },
                callBack: doSubmit
            });
            layer.full(index);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            var yi=body.find('#along').val();
            var er=body.find('#latitude').val();
            $("#mapX").val(yi);
            $("#mapY").val(er);
            layer.close(index);
        }
    </script>
</body>
</html>